;;;Place a single line pipe break symbol (polyline) at the end of a line.
;;;
;;;       Requirements: transpt.lsp (point translator used with the list
;;;                                  returned by an nentsel selection)
;;;
;;;	AUTHOR: HENRY C. FRANCIS
;;;		425 N. ASHE ST.
;;;		SOUTHERN PINES, NC 28387
;;;              
;;;		All rights reserved without prejudice.
;;;
;;;	Copyright:	4-16-95
;;;	Edited:		10-31-2005
;;;
(defun SLPB_ERROR (msg / )
  (SETQ OLD_SLPBERROR *ERROR*)
  (PRINC msg)
  (IF slpb_mode
    (setq slpb_mode (setvar "osmode" slpb_mode))
  )
  (PRINC)
)
(DEFUN C:SLPB ( / bkp1b bkp1m bkp1r bkp1l bkp1a bkp2b bkp2m bkp2r bkp2l
bkp2a bkp3b bkp3m bkp3r bkp3l bkp3a)
(setq slpb_mode (getvar"osmode"))
(setvar"osmode"0)
(if mklayr nil (load"mklayr"))
(c:svlayr)
(if dimscl nil (load "dimscl"))
(dimscl)
(setq txtht (* 0.110 dimsc))
(while
  (setq sel1 (nentsel "\nSelect line"))
  (if (= "LINE" (cdr(assoc 0(entget(car sel1)))))
    (progn
      (setq endp1 (cdr(assoc 10(entget(car sel1)))))
      (setq endp2 (cdr(assoc 11(entget(car sel1)))))
    )
    (if (= "VERTEX" (cdr(assoc 0(entget(car sel1)))))
      (progn
        (setq endp1 (cdr(assoc 10(entget(car sel1)))))
        (setq endp2 (cdr(assoc 10(entget(entnext(car sel1))))))
      )
      (princ "\nNot a LINE or POLYLINE.")
    )
  );if
  (if (> (length sel1) 2)
    (progn
      (if transpt nil (load"transpt"))
      (setq endp1 (transpt sel1 endp1))
      (setq endp2 (transpt sel1 endp2))
    )
  )
  (setq lang (angle endp1 endp2))
  (setq lrang (+ lang (/ pi 2.00)))
  (if (>(distance endp1 (cadr sel1))(distance endp2 (cadr sel1)))
    (setq pt1 endp2)
    (setq pt1 endp1)
  );if
  (setq bl1 (polar pt1 lrang (* txtht 0.50))
        bl2 (polar pt1 (+ lrang (* pi 0.15)) (* txtht 0.375))
        bl3 (polar bl2 (+ lrang (* pi 1.15)) (* txtht 0.75))
        bl4 (polar pt1 (+ lrang pi) (* txtht 0.50))
  );setq
  (setq colr "2"
	colra NIL
	colri NIL)
;;;  (if gvpno nil (load"gvpno"))
;;;  (gvpno)
;;;  (c:mklayr)
  (PROGN
    (IF (WCMATCH (CDR (ASSOC 8(ENTGET(CAR sel1)))) "*|*");if the layer is an xref layer
      (SETQ token-laylst (DOS_STRTOKENS (CDR (ASSOC 8(ENTGET(CAR sel1)))) "|");strip off the xref prefix
            pblayer (CADR token-laylst)
      )
      (SETQ pblayer (CDR (ASSOC 8(ENTGET(CAR sel1)))))
    )
    (SETQ temp-clayr clayr
          clayr pblayer
    )
    (IF (clnmstd)
      (PROGN
        (SETQ pblayer (STRCASE (STRCAT (SUBSTR pblayer 1 1) "-" (SUBSTR pblayer 3)))
              clayr temp-clayr
              temp-clayr NIL
        )
      )
    )
    (SETQ pl_assoc_8_lst (LIST (CONS 8 pblayer)))
    (IF make_layer_ent NIL (LOAD "make_layer_ent" "\nFile MAKE_LAYER_ENT.LSP not loaded! "))
    (make_layer_ent pl_assoc_8_lst)
    (ENTMAKE (LIST (CONS 0 "POLYLINE") (CONS 10 (LIST 0 0 0)) (CONS 8 pblayer)))
    (ENTMAKE (LIST (CONS 0 "VERTEX") (CONS 10 bl1) (CONS 8 pblayer)))
    (ENTMAKE (LIST (CONS 0 "VERTEX") (CONS 10 bl2) (CONS 8 pblayer)))
    (ENTMAKE (LIST (CONS 0 "VERTEX") (CONS 10 bl3) (CONS 8 pblayer)))
    (ENTMAKE (LIST (CONS 0 "VERTEX") (CONS 10 bl4) (CONS 8 pblayer)))
    (ENTMAKE (LIST (CONS 0 "SEQEND")))
  ) ;_ end of PROGN

;;;  (command ".pline" bl1 bl2 bl3 bl4 "")
  (command ".pedit" "l" "f" "")
);while
(c:rslayr)
  (IF slpb_mode
    (setq slpb_mode (setvar "osmode" slpb_mode))
  )
  (princ)
);defun
